package com.ftg.mall.base.util.tools;


import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;
/**
 * @author wangty
 * @date 2022/11/22
 */
public class MyMailUtil {

    /**
     * 声明帐号信息
     * @return
     */
    private static MailAccount initAccount(){
        MailAccount mailAccount = new MailAccount();
        mailAccount.setHost("smtp.163.com");
        mailAccount.setFrom("wty1269230642@163.com");
        mailAccount.setPass("PCREGAFFMVBMYEAT");
        return mailAccount;
    }

    /**
     * 通用的邮件发送方法
     */
    public static boolean sendMail(String to,String subject,String content){
        MailUtil.send(MyMailUtil.initAccount(),to,subject,content,true,null);
        return true;
    }
}
